package task02;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class Computer {
    //接受传递的集合
    private   ArrayList list;

    public ArrayList getList() {
        return list;
    }
    public void setList(ArrayList arrayList) {
        this.list=arrayList;
    }
    public float max() {
        Collections.sort(list);
        float max=(float)list.get(list.size()-1);
        return max;
    }

    public float min() {
        Collections.sort(list);

        return (float)list.get(0);
    }

    public float avg() {
        list.remove(max());
        list.remove(min());
        float sum=0,avg=0;
        Iterator iterator=list.iterator();
        while(iterator.hasNext()){
            sum+=(float)iterator.next();
        }
        avg=sum/list.size();
        return avg;
    }


}
